/**
 * 
 */
package com.antilia.infomaresme.pages.edit;

import org.apache.wicket.util.string.Strings;

/**
 * @author Ernesto
 *
 */
public enum AllowedImageFiles {
	
	JPG, JPEG, GIF, PNG;

	public static boolean isAllowed(String file) {
		if(Strings.isEmpty(file) || file.lastIndexOf('.') == -1)
			return false;
		String ext = file.substring(file.lastIndexOf('.')+1, file.length()).toUpperCase();
		for(AllowedImageFiles allowedImageFiles: values()) {
			if(allowedImageFiles.name().equals(ext))
				return true;
		}
		return false;
	}
}
